﻿<script src="~/Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script src="~/Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script src="~/Scripts/fancybox/jquery.easing-1.3.pack.js"></script>
<script src="~/Scripts/jquery.corner.js"></script>
<link href="~/Scripts/fancybox/image/jquery.fancybox-1.3.4.css" rel="stylesheet" />

<!--fancybox弹出框 -->
<script id="MessageBox_Confirm" type="text/html">
    <!--试题删除确认弹出框 start-->
    <div class="r_warnBox">
        <div class="r_warnBox_tit">
            <span><strong>提示</strong></span>
            @* <span class='r_warnBox_close'>
                <a href='javascript:;' onclick="$.fancybox.close()">x</a>
            </span>*@
        </div>
        <div class="r_roomBoxCont">
            <p class="alert">[Content]</p>
            <p class="confirm"><a class="sure" href="javascript:;">确定</a><a class="cancel" href="javascript:;" onclick="$.fancybox.close();">取消</a></p>
        </div>

    </div>
    <!--试题删除确认弹出框 end-->
</script>
<!--fancybox确认框 -->
<script id="MessageBox_Alert" type="text/html">
    <div class='r_warnBox' style="width: 200px;">
        <div class='r_warnBox_tit'>
            <span><strong>提示</strong></span>
            <span class='r_warnBox_close'>
                <a href='javascript:;' onclick="$.fancybox.close()">x</a>
            </span>
        </div>
        <div id='alert_message' class='r_roomBoxCont'>
            <p class='alert'>[Content]</p>
        </div>

    </div>
</script>
<!--boxy弹出框 -->
<script type="text/html" id="boxyContent">
    <div style="width: 200px; text-align: center;">
        <b>[Content]</b>
    </div>
</script>


<script type="text/javascript">
    var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm'); //i g m是指分别用于指定区分大小写的匹配、全局匹配和多行匹配。

    window.alert = function (msg) {
        var html = document.getElementById("MessageBox_Alert").innerHTML;
        var result = html.replace(reg, function (node, key) { return { 'Content': msg }[key]; });
        $.fancybox(result, {
            'autoScale': false,
            'showCloseButton': false,
            'scrolling': 'no',
            'callbackOnClose': function () { window.location.href = "http://www.sina.com"; },
        });

    }

    window.confirm = function (msg, callBack) {
        var html = document.getElementById("MessageBox_Confirm").innerHTML;
        var result = html.replace(reg, function (node, key) { return { 'Content': msg }[key]; });
        $.fancybox(result, {
            'autoScale': false,
            'scrolling': 'no',
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'easingIn': 'easeOutBack',
            'easingOut': 'easeInBack',
            afterShow: function () {
                $('p.confirm a.sure').on('click', function () {
                    callBack();
                });
            }
        });

    }

    //boxy弹出框
    var html = document.getElementById("boxyContent").innerHTML;
    var options = { title: '消息提示', closeText: 'x' };

    // dialog对话框
    var dialogBox = function (msg, timer) {
        var result = html.replace(reg, function (node, key) { return { 'Content': msg }[key]; });
        var timer = timer || 100000000;//默认100000000S后关闭
        new Boxy(result, $.extend({
            behaviours: function () {
                setTimeout('$(".boxy-wrapper").hide();', timer);
            }
        }, options));
    }
    //alter确认框
    var alertBox = function (msg) {
        var result = html.replace(reg, function (node, key) { return { 'Content': msg }[key]; });
        Boxy.alert(result, null, options);
    }
    //confirm确认框
    var confirmBox = function (msg, callback) {
        var result = html.replace(reg, function (node, key) { return { 'Content': msg }[key]; });
        Boxy.confirm(result, callback(), options);
    }
</script>
